<template>
	<view>
		<!-- 布局 一个row是12-->
		<u-row class="box">
			<u-col span="6" v-for="goods in goodsList">
				<goods-card :goods="goods" :loading="loading"></goods-card>  <!-- item是变量所以加上双引号可进行双向绑定 -->
			</u-col>
		</u-row>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				goodsList: [{},{},{},{}],
				loading: true,
			}
		},
		methods: {
			onLoad(){
				this.getCollect();
			},
			async getCollect(){
				this.loading=true;
				const res = await uni.$u.api.collectList();
				let len = res.data.length;
				let i=0;
				let tmp = [];
				for(; i<len; i++){
					tmp.push(res.data[i].goods);
				}
				this.goodsList=tmp;
				this.loading = false;
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box{
		flex-wrap: wrap;
	};
</style>
